Earlier, the command F s
(mh-search) was introduced which helps you find
messages that lie buried in your folders (see Folders). This chapter covers this
command in more detail. Several commands are used to compose the
search criteria and to start searching. A couple of them can be
found in the ‘Search’ menu.
mh-help).
mh-search-program
(mh-index-do-search).
mh-pick-do-search).
mh-help).
mh-to-field).
mh-to-field).
mh-to-field).
mh-to-field).
mh-to-field).
mh-to-field).
mh-to-field).
mh-to-field).
mh-to-field).
mh-to-field).Another few commands are available in the MH-Folder buffer resulting from a search.
mh-index-next-folder).
mh-index-previous-folder).
mh-index-visit-folder).There is one option from the ‘mh-search’ customization group used in searching.
mh-search-programThe following hook is available.
mh-search-mode-hookmh-search-mode
(default: nil).The following face is available.
mh-search-folder The command F
s (mh-search-folder) helps you find messages
in your entire corpus of mail. You can search for messages to or
from a particular person or about a particular subject. In fact,
you can also search for messages containing selected strings in
any arbitrary header field or any string found within the
messages.
Out of the box, MH-E uses pick to find messages. With a little extra effort, you can set an indexing program which rewards you with extremely quick results. The drawback is that sometimes the index does not contain the words you're looking for. You can still use pick in these situations.
You are prompted for the folder to search. This can be ‘all’ to search all folders. Note that the search works recursively on the listed folder.
Next, an MH-Search buffer appears where you can enter search criteria.
From:
To:
Cc:
Date:
Subject:
--------
#
--:** search-pattern All L7 (MH-Search)---------------------------
Type C-c C-c to search messages, C-c C-p to use pick, C-c ? for help
|
Edit this template by entering your search criteria in an appropriate header field that is already there, or create a new field yourself. If the string you're looking for could be anywhere in a message, then place the string underneath the row of dashes.
As an example, let's say that we want to find messages from Ginnean about horseback riding in the Kosciusko National Park (Australia) during January, 1994. Normally we would start with a broad search and narrow it down if necessary to produce a manageable amount of data, but we'll cut to the chase and create a fairly restrictive set of criteria as follows:
From: ginnean
To:
Cc:
Date: Jan 1994
Subject:
--------
horse
kosciusko
As with MH-Letter mode,
MH-Search provides commands like C-c C-f C-t
(mh-to-field) to help you fill in the blanks. See
Editing
Message.
If you find
that you do the same thing over and over when editing the search
template, you may wish to bind some shortcuts to keys. This can
be done with the variable mh-search-mode-hook, which
is called when F s is run on a new pattern.
To perform the search, type C-c C-c
(mh-index-do-search). Sometimes you're searching for
text that is either not indexed, or hasn't been indexed yet. In
this case you can override the default method with the pick
method by running the command C-c C-p
(mh-pick-do-search).
The messages that are
found are put in a temporary sub-folder of
‘+mhe-index’
and are displayed in an MH-Folder buffer. This buffer is special
because it displays messages from multiple folders; each set of
messages from a given folder has a heading with the folder name.
The appearance of the heading can be modified by customizing the
face mh-search-folder. You can jump back and forth
between the headings using the commands <TAB>
(mh-index-next-folder) and S-<TAB>
(mh-index-previous-folder).
In addition, the command v
(mh-index-visit-folder) can be used to visit the
folder of the message at point. Initially, only the messages that
matched the search criteria are displayed in the folder. While
the temporary buffer has its own set of message numbers, the
actual messages numbers are shown in the visited folder. Thus,
the command v is useful to find the actual message
number of an interesting message, or to view surrounding messages
with the command F r mh-rescan-folder.
See Folders.
Because this folder is temporary, you'll
probably get in the habit of killing it when you're done with
F k (mh-kill-folder). See Folders.
You can regenerate the results by running F s with a prefix argument.
Note: This command uses an ‘X-MHE-Checksum:’ header field to cache the MD5 checksum of a message. This means that if an incoming message already contains an ‘X-MHE-Checksum:’ field, that message might not be found by this command. The following procmail recipe avoids this problem by renaming the existing header field:
:0 wf
| formail -R "X-MHE-Checksum" "X-Old-MHE-Checksum"
See Limits, for an alternative interface to searching.
The command F
s (mh-search) runs the command defined by the
option mh-search-program. The default value is
‘Auto-detect’
which means that MH-E will automatically choose one of
swish++,
swish-e,
mairix,
namazu,
pick and
grep in that order. If,
for example, you have both swish++ and mairix installed and you want to use
mairix, then you can
set this option to ‘mairix’.
The following sub-sections describe how to set up the various indexing programs to use with MH-E.
In the examples below, replace /home/user/Mail with the path to your MH directory.
First create the directory /home/user/Mail/.swish++. Then create the file /home/user/Mail/.swish++/swish++.conf with the following contents:
IncludeMeta Bcc Cc Comments Content-Description From Keywords
IncludeMeta Newsgroups Resent-To Subject To
IncludeMeta Message-Id References In-Reply-To
IncludeFile Mail *
IndexFile /home/user/Mail/.swish++/swish++.index
Use the following command line to generate the swish index. Run this daily from cron:
find /home/user/Mail -path /home/user/Mail/mhe-index -prune \
-o -path /home/user/Mail/.swish++ -prune \
-o -name "[0-9]*" -print \
| index -c /home/user/Mail/.swish++/swish++.conf -
This command does not index the folders that hold the results of your searches in ‘+mhe-index’ since they tend to be ephemeral and the original messages are indexed anyway.
On some systems (Debian GNU/Linux, for example), use index++ instead of index.
In the examples below, replace /home/user/Mail with the path to your MH directory.
First create the directory /home/user/Mail/.swish. Then create the file /home/user/Mail/.swish/config with the following contents:
DefaultContents TXT*
IndexDir /home/user/Mail
IndexFile /home/user/Mail/.swish/index
IndexName "Mail Index"
IndexDescription "Mail Index"
IndexPointer "http://nowhere"
IndexAdmin "nobody"
#MetaNames automatic
IndexReport 3
FollowSymLinks no
UseStemming no
IgnoreTotalWordCountWhenRanking yes
WordCharacters abcdefghijklmnopqrstuvwxyz0123456789-
BeginCharacters abcdefghijklmnopqrstuvwxyz
EndCharacters abcdefghijklmnopqrstuvwxyz0123456789
IgnoreLimit 50 1000
IndexComments 0
FileRules filename contains \D
FileRules pathname contains /home/user/Mail/.swish
FileRules pathname contains /home/user/Mail/mhe-index
FileRules filename is index
This configuration does not index the folders that hold the results of your searches in ‘+mhe-index’ since they tend to be ephemeral and the original messages are indexed anyway.
If there are any directories you would like to ignore, append lines like the following to config:
FileRules pathname contains /home/user/Mail/scripts
Use the following command line to generate the swish index. Run this daily from cron:
swish-e -c /home/user/Mail/.swish/config
In the examples below, replace /home/user/Mail with the path to your MH directory.
First create the directory /home/user/Mail/.mairix. Then create the file /home/user/Mail/.mairix/config with the following contents:
base=/home/user/Mail
# List of folders that should be indexed. 3 dots at the end means there
# are subfolders within the folder
mh=archive...:inbox:drafts:news:sent:trash
vfolder_format=mh
database=/home/user/Mail/.mairix/database
Use the following command line to generate the mairix index. Run this daily from cron:
mairix -f /home/user/Mail/.mairix/config
In the examples below, replace /home/user/Mail with the path to your MH directory.
First create the directory /home/user/Mail/.namazu. Then create the file /home/user/Mail/.namazu/mknmzrc with the following contents:
package conf; # Don't remove this line!
$ADDRESS = 'user@localhost';
$ALLOW_FILE = "[0-9]*";
$EXCLUDE_PATH = "^/home/user/Mail/(mhe-index|spam)";
This configuration does not index the folders that hold the results of your searches in ‘+mhe-index’ since they tend to be ephemeral and the original messages are indexed anyway.
Use the following command line to generate the namazu index. Run this daily from cron:
mknmz -f /home/user/Mail/.namazu/mknmzrc -O /home/user/Mail/.namazu \
-q /home/user/Mail
This search method does not require any setup.
Read pick(1) or the section Finding Messages with pick in the MH book to find out more about how to enter the criteria.
This search method does not require any setup.
Unlike the other search methods, this method does not use the MH-Search buffer. Instead, you simply enter a regular expression in the minibuffer. For help in constructing regular expressions, see your man page for grep.